<template>
    <div>
        <!-- 使用Son1组件 -->
        <Son1 @myevent="getdata"></Son1>
        <!-- 使用Son2组件 -->
        <Son2 :contentlist="contentlist"></Son2>
    </div>
</template>

<script>
// 引入Son1组件
import Son1 from './Son1.vue';
import Son2 from './Son2.vue';
export default {
    data() {
        return {
            contentlist: [
                { id: 1, name: '张三', content: '1111111111' },
                { id: 2, name: '李四', content: '2222222222' }
            ]
        }
    },
    methods: {
        getdata(data) {
            console.log('data', data);
            this.contentlist.unshift({
                id: this.contentlist[0].id - 1,
                name: data[0],
                content: data[1]
            })
        }
    },
    components: {
        Son1,
        Son2
    }
}
</script>
<style scoped></style>